<me:UITMKRF  x:Class="WPFExcelReport.TSAV33"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"
     xmlns:Localization="clr-namespace:Localization;assembly=Localization"
     xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL"
             xmlns:WF="clr-namespace:WPFExcelReport;assembly=TICC_WFEVENTS"
             
    xmlns:me="clr-namespace:WPFExcelReport"
    x:Name="TV"
    Loaded="Window_Loaded"
 >
    <me:UITMKRF.Resources>
        <ucd:SubStrConverter x:Key="substr"/>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
         <ucd:Divideby1440  x:Key="day"/>
        <ucd:Divideby480  x:Key="shift"/>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:PNumConverter x:Key="pnum"/>
        <ucd:NOTConverter x:Key="not"/>
        <ucd:EearlyEndGrade x:Key="edc"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:UITMKRF.Resources>
    <Grid IsEnabled="{Binding IsBusy,ElementName=TV,Converter={StaticResource not}}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0" Name="cMain">
            <WrapPanel>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button Grid.Column="0"  Width="20" Height="20"   Margin="10,0,0,0"  Click="QueryCommand">
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/download.png" />
                        </Button.Background>
                    </Button>
                    <TextBlock Grid.Column="1"  VerticalAlignment="Center" Text="{Binding Source={Localization:TranslateExtension Word=载入}}"></TextBlock>
                </Grid>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button Grid.Column="0"  Width="20" Height="20"   Margin="10,0,0,0"  Click="StartScheduleCommand">
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/memory.png" />
                        </Button.Background>
                    </Button>
                    <TextBlock Grid.Column="1"  VerticalAlignment="Center" Text="{Binding Source={Localization:TranslateExtension Word=排产}}"></TextBlock>
                </Grid>
                <WF:TBTNEXE CMD="AV33SPLIT" DLL="TICC_MKRF" STWNW="MainWindow"
                            INFO="拆分"
                            IsInfo="True"
                            ART="{Binding KSTKRS,ElementName=TV}"
                            VAR="{Binding KST,ElementName=TV}"
                            FARBE="{Binding AGANG,ElementName=TV}"
                            FINISH="{Binding AMTYP,ElementName=TV}"
                            />
                 <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock Margin="20,0,0,0" Grid.Column="0"  VerticalAlignment="Center" Text="{Binding Source={Localization:Translate Word=生产同步}}"   Width="Auto"/>
                    <CheckBox Grid.Column="1" IsChecked="{Binding IsRestart,ElementName=TV}"></CheckBox>
                </Grid>
                <WF:TBTNEXE CMD="AVAFKS" DLL="TICC_MKRF" STWNW="MainWindow"
                            INFO="实际作业"
                            IsInfo="True"
                            ART="{Binding KSTKRS,ElementName=TV}"
                            VAR="{Binding KST,ElementName=TV}"
                            FARBE="{Binding AGANG,ElementName=TV}"
                            FINISH="{Binding AMTYP,ElementName=TV}"
                            />
                <CheckBox Content="甘特图" IsChecked="{Binding IsShowGantt,ElementName=TV}"></CheckBox>
                <Button Margin="20,0,0,0" Content="{Binding Source={Localization:Translate Word=调整高度}}" Click="ZoneAdjustCommand"/>
                <WF:TBTNEXE CMD="STAK02" DLL="TICC_STDMACHINE" STWNW="MainWindow"
                            INFO="生产线负载"
                            IsInfo="True"
                            ART="{Binding KSTKRS,ElementName=TV}"
                            VAR="{Binding KST,ElementName=TV}"
                            FARBE="{Binding AGANG,ElementName=TV}"
                            FINISH="{Binding AMTYP,ElementName=TV}"
                            />
                <WF:TBTNEXE CMD="SSRULES" DLL="TICC_SRULES" STWNW="MainWindow"
                            INFO="设备约束"
                            IsInfo="True"
                            ART="{Binding KSTKRS,ElementName=TV}"
                            VAR="{Binding KST,ElementName=TV}"
                            FARBE="{Binding AGANG,ElementName=TV}"
                            FINISH="{Binding AMTYP,ElementName=TV}"
                            />
                <WF:TBTNEXE CMD="STSPINSPEED" DLL="TICC_SPINSPEED" STWNW="MainWindow"
                            INFO="速度设定"
                            IsInfo="True"
                           ART="{Binding KSTKRS,ElementName=TV}"
                            VAR="{Binding KST,ElementName=TV}"
                            FARBE="{Binding AGANG,ElementName=TV}"
                            FINISH="{Binding AMTYP,ElementName=TV}"
                            />
                <WF:TBTNEXE CMD="SSTDM" DLL="TICC_STDMACHINE" STWNW="MainWindow"
                            INFO="生产线设定"
                            IsInfo="True"
                           ART="{Binding KSTKRS,ElementName=TV}"
                            VAR="{Binding KST,ElementName=TV}"
                            FARBE="{Binding AGANG,ElementName=TV}"
                            FINISH="{Binding AMTYP,ElementName=TV}"
                            />
                <WF:TBTNEXE CMD="SAM21" DLL="TAMSTAMM" STWNW="MainWindow"
                            INFO="设备管理"
                            IsInfo="True"
                            ART="{Binding KSTKRS,ElementName=TV}"
                            VAR="{Binding KST,ElementName=TV}"
                            FARBE="{Binding AGANG,ElementName=TV}"
                            FINISH="{Binding AMTYP,ElementName=TV}"
                            /> 
                <WF:TBTNEXE CMD="SGMF02" DLL="TICC_MKRF" STWNW="MainWindow"
                            INFO="同类订单"
                            IsInfo="True"
                            ART="{Binding KSTKRS,ElementName=TV}"
                            VAR="{Binding KST,ElementName=TV}"
                            FARBE="{Binding AGANG,ElementName=TV}"
                            FINISH="{Binding AMTYP,ElementName=TV}"
                            /> 
                <WF:TBTNEXE CMD="SPRMF03" DLL="TICC_MKRF" STWNW="MainWindow"
                            INFO="打印"
                            IsInfo="True"
                            ART="{Binding KSTKRS,ElementName=TV}"
                            VAR="{Binding KST,ElementName=TV}"
                            FARBE="{Binding AGANG,ElementName=TV}"
                            FINISH="{Binding AMTYP,ElementName=TV}"
                            />
            </WrapPanel>
        </StackPanel>
        <Grid Grid.Row="1" Visibility="{Binding IsAV,ElementName=TV,Converter={StaticResource bv}}">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="1*"></RowDefinition>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
               <ColumnDefinition Width="1*"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <StackPanel Grid.Row="0" >
                <WrapPanel  Margin="0,0,-0.2,0">
                    <TextBlock Margin="10,0,0,0" Text="{Binding Source={Localization:Translate Word=生产单}}" VerticalAlignment="Center"/>
                    <TextBox VerticalAlignment="Center" Background="White" BorderBrush="Black"    Width="20" Margin="1,0,0,0" Text="{Binding ABFAUFKRS,Source={StaticResource vwMaster}}" />
                    <TextBox VerticalAlignment="Center" Background="White"  BorderBrush="Black"   Width="60" Margin="1,0,0,0" Text="{Binding ABFAUFLFD,Source={StaticResource vwMaster}}" />
                    <TextBox  VerticalAlignment="Center" Background="White"  BorderBrush="Black"  Width="30"   Margin="1,0,0,0" Text="{Binding ABFAUFPOS,Source={StaticResource vwMaster}}" />
                    <TextBlock Margin="10,0,0,0" Text="{Binding Source={Localization:Translate Word=机台}}" VerticalAlignment="Center"/>
                    <TextBox VerticalAlignment="Center" Background="White" BorderBrush="Black"    Width="20" Margin="1,0,0,0" Text="{Binding ABFBNRKRS,Source={StaticResource vwMaster}}" />
                    <TextBox VerticalAlignment="Center" Background="White"  BorderBrush="Black"   Width="60" Margin="1,0,0,0" Text="{Binding ABFBLFDNR,Source={StaticResource vwMaster}}" />
                    <TextBox  VerticalAlignment="Center" Background="White"  BorderBrush="Black"  Width="30"   Margin="1,0,0,0" Text="{Binding ABFBPOS,Source={StaticResource vwMaster}}" />
                    <TextBlock VerticalAlignment="Center" Margin="10,0,0,0" Text="{Binding Source={Localization:Translate Word=日期}}" />
                    <TextBox  VerticalAlignment="Center" Background="White"  BorderBrush="Black"  Width="80"   Margin="1,0,0,0" Text="{Binding MKFPLDATV,Source={StaticResource vwMaster}}" />
                    <TextBlock VerticalAlignment="Center" Margin="10,0,0,0" Text="{Binding Source={Localization:Translate Word=时间}}" />
                    <TextBox  VerticalAlignment="Center" Background="White"  BorderBrush="Black"  Width="80"   Margin="1,0,0,0" Text="{Binding MKFPLTIME,Source={StaticResource vwMaster}}" />
                    <TextBlock VerticalAlignment="Center" Margin="10,0,0,0" Text="{Binding Source={Localization:Translate Word=班次}}" />
                    <TextBox VerticalAlignment="Center" Background="White"  BorderBrush="Black"  Width="30"   Margin="1,0,0,0" Text="{Binding MKFSCHICHTV,Source={StaticResource vwMaster}}" />
                    <Button Height="20" Width="20"      Margin="10,0,0,0" Click="ConfirmScheduleCommand">
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/button_ok.png" />
                        </Button.Background>
                    </Button>
                    <TextBlock  Text="{Binding Source={Localization:TranslateExtension Word=固定}}"></TextBlock>
                    <Button   Content="{Binding Source={Localization:Translate Word=查看}}"   Margin="10,0,0,0" Width="Auto" Click="ShowDetailCommand" />
                </WrapPanel>
                <WrapPanel>
                    <TextBlock   Width="Auto"  Margin="0,0,0,0" Text="{Binding Source={Localization:Translate Word=生产批次}}" />
                    <TextBox Background="White"  Width="40"   CharacterCasing="Upper" Margin="5,0,0,0" Text="{Binding KRS,ElementName=TV}" />
                    <TextBox Background="White"  Width="80"   Margin="5,0,0,0" Text="{Binding LFD,ElementName=TV}"/>
                    <TextBox  Background="White"  Width="40"   Margin="5,0,0,0" Text="{Binding POS,ElementName=TV}" />
                    <TextBox  Background="White"  Width="40"    Margin="5,0,0,0" Text="{Binding MKFTP,ElementName=TV}" />
                    <TextBlock Margin="10,0,0,0" Text="{Binding Source={Localization:Translate Word=仅未确认}}"  VerticalAlignment="Center"/>
                    <CheckBox Name="chkS" VerticalAlignment="Center" Margin="10,0,0,0"></CheckBox>
                    <Button Content="{Binding Source={Localization:Translate Word=筛选}}"   Margin="10,0,0,0" Width="Auto" Click="btnJobFilter_Click"/>
                    <Button Content="{Binding Source={Localization:Translate Word=今日开台}}"   Margin="10,0,0,0" Width="Auto" Click="TodayStartCommand"/>
                    <Button Content="{Binding Source={Localization:Translate Word=显示所有}}"   Margin="10,0,0,0" Width="Auto" Click="btnShowAllJob_Click"/>
                    <TextBlock  Background="White"  Width="40" Text="{Binding Path=MKFTP,Converter={StaticResource ResourceKey=pnum},Source={StaticResource vwMaster}}" Margin="5,0,0,0"  />

                </WrapPanel>
            </StackPanel>
            <DataGrid  Grid.Row="1" CanUserReorderColumns="True"  
                          FontSize="12"
                          Height="{Binding zAV33Height,ElementName=TV}"
                          CanUserResizeRows="True" CanUserSortColumns="True"                  
                          AutoGenerateColumns="False"   
                          EnableRowVirtualization="True"  
                          RowDetailsVisibilityMode="VisibleWhenSelected" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                          IsSynchronizedWithCurrentItem="True" Opacity="10" Visibility="Visible"
                          ItemsSource="{Binding Source={StaticResource vwMaster}}"  
                           x:Name="dlgMaster" 
                  >
                <DataGrid.Columns>
                    <DataGridTextColumn Binding="{Binding Path=JOBTYPE}"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=ABKKDAUFTNR}" Header="{Binding Source={Localization:TranslateExtension Word=销售单}}"  Width="Auto" />
                    <DataGridTextColumn FontSize="14" Foreground="Red" Binding="{Binding Path=ABFBLFDNR, Converter={StaticResource ResourceKey=pnum}}" Header="{Binding Source={Localization:TranslateExtension Word=机台}}"  Width="Auto" />                    
                    <DataGridTextColumn Binding="{Binding Path=VKPLIEFTERM,Converter={StaticResource substr},ConverterParameter=4+4}" Header="{Binding Source={Localization:TranslateExtension Word=客单交期}}"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=ABPFARBE}" Header="{Binding Source={Localization:TranslateExtension Word=色号}}"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=ABFAUFKRS}" Header=" "  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=ABFAUFLFD, Converter={StaticResource ResourceKey=pnum}}" Header="{Binding Source={Localization:TranslateExtension Word=生产单}}"  Width="Auto" />
                     <DataGridTextColumn Binding="{Binding Path=MKFTP, Converter={StaticResource ResourceKey=pnum}}" Header="{Binding Source={Localization:TranslateExtension Word=分批}}"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=JP05}" Header="{Binding Source={Localization:TranslateExtension Word=数量}}"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=ABFISTARTDAT,Converter={StaticResource substr},ConverterParameter=4+4}"  Header="{Binding Source={Localization:TranslateExtension Word=实际}}"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=ABFSOLLSTART,Converter={StaticResource substr},ConverterParameter=4+4}" Header="{Binding Source={Localization:TranslateExtension Word= 计划}}"  Width="Auto" Visibility="Collapsed" />
                    <DataGridTextColumn Binding="{Binding Path=MKFPLDATV,Converter={StaticResource substr},ConverterParameter=4+4}"  Header="{Binding Source={Localization:TranslateExtension Word=计划}}"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=MKFPLTIME}"    Visibility="Collapsed" Width="Auto"  />
                    <DataGridTextColumn Binding="{Binding Path=ABFSOLLDAT,Converter={StaticResource substr},ConverterParameter=4+4}" Header="{Binding Source={Localization:TranslateExtension Word=初计划}}"  Width="Auto" Visibility="Collapsed" />
                    <DataGridTextColumn Binding="{Binding Path=MKFSCHICHTV}" Header="{Binding Source={Localization:TranslateExtension Word=班次}}"  Width="Auto"  Visibility="Collapsed" />
                    <DataGridTextColumn Binding="{Binding Path=ENDATE,Converter={StaticResource substr},ConverterParameter=4+4}" Header="{Binding Source={Localization:TranslateExtension Word=完成}}"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=ENDTIME}"   Visibility="Collapsed"  Width="Auto" />                    
                    <DataGridTemplateColumn Width="40" Header="{Binding Source={Localization:TranslateExtension Word=完成天数}}" >
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate >
                                <Grid >
                                    <TextBlock  Text="{Binding JP12}" TextAlignment="Center"   Width="40" >
                                        <TextBlock.Background>
                                            <SolidColorBrush Color="{Binding JP12,Converter={StaticResource ResourceKey=edc}}"></SolidColorBrush>
                                        </TextBlock.Background>
                                    </TextBlock>
                                </Grid>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                     <DataGridTextColumn Binding="{Binding Path=ABFIMG,Converter={StaticResource d1000}}"  Header="{Binding Source={Localization:TranslateExtension Word=产量}}"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=ABFAMASCHZT, Converter={StaticResource ResourceKey=day}}" Header="{Binding Source={Localization:TranslateExtension Word=天数}}"  Width="Auto" /> 
                    <DataGridTextColumn Binding="{Binding Path=ABFAMASCHZT}" Header="{Binding Source={Localization:TranslateExtension Word=分钟}}"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=JP01}" Header="{Binding Source={Localization:TranslateExtension Word=纱支}}"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=JP04}" Header="{Binding Source={Localization:TranslateExtension Word=产品组}}"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=JP05}" Header="{Binding Source={Localization:TranslateExtension Word=重量}}"  Width="Auto" />
                    <DataGridTextColumn Binding="{Binding Path=ABAID}" Header="{Binding Source={Localization:TranslateExtension Word=ABAID}}"  Width="Auto" />                    
                </DataGrid.Columns>
            </DataGrid  >
        </Grid> 
     </Grid>
</me:UITMKRF>
